home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16577 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  1.9 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news text default
99% file C source, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 6d 69 | 74 74 65 6e 73 2e 73 74 |Path: mi|ttens.st|
|00000010| 75 2e 72 70 69 2e 65 64 | 75 21 6e 65 78 78 0a 46 |u.rpi.ed|u!nexx.F|
|00000020| 72 6f 6d 3a 20 4b 65 6e | 67 6f 20 48 61 73 68 69 |rom: Ken|go Hashi|
|00000030| 6d 6f 74 6f 20 3c 6e 65 | 78 78 40 6d 69 74 74 65 |moto <ne|xx@mitte|
|00000040| 6e 73 2e 73 74 75 2e 72 | 70 69 2e 65 64 75 3e 0a |ns.stu.r|pi.edu>.|
|00000050| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000060| 2e 6c 61 6e 67 2e 63 2b | 2b 0a 53 75 62 6a 65 63 |.lang.c+|+.Subjec|
|00000070| 74 3a 20 52 65 3a 20 54 | 48 45 20 53 54 52 55 43 |t: Re: T|HE STRUC|
|00000080| 54 20 6f 66 20 43 2b 2b | 0a 44 61 74 65 3a 20 54 |T of C++|.Date: T|
|00000090| 68 75 2c 20 31 31 20 41 | 70 72 20 31 39 39 36 20 |hu, 11 A|pr 1996 |
|000000a0| 30 32 3a 32 35 3a 31 34 | 20 2d 30 34 30 30 0a 4f |02:25:14| -0400.O|
|000000b0| 72 67 61 6e 69 7a 61 74 | 69 6f 6e 3a 20 52 65 6e |rganizat|ion: Ren|
|000000c0| 73 73 65 6c 61 65 72 20 | 50 6f 6c 79 74 65 63 68 |sselaer |Polytech|
|000000d0| 6e 69 63 20 49 6e 73 74 | 69 74 75 74 65 2c 20 54 |nic Inst|itute, T|
|000000e0| 72 6f 79 20 4e 59 2c 20 | 55 53 41 0a 4d 65 73 73 |roy NY, |USA.Mess|
|000000f0| 61 67 65 2d 49 44 3a 20 | 3c 50 69 6e 65 2e 4c 4e |age-ID: |<Pine.LN|
|00000100| 58 2e 33 2e 39 31 2e 39 | 36 30 34 31 31 30 32 31 |X.3.91.9|60411021|
|00000110| 39 31 37 2e 31 30 30 37 | 43 2d 31 30 30 30 30 30 |917.1007|C-100000|
|00000120| 40 6d 69 74 74 65 6e 73 | 2e 73 74 75 2e 72 70 69 |@mittens|.stu.rpi|
|00000130| 2e 65 64 75 3e 0a 52 65 | 66 65 72 65 6e 63 65 73 |.edu>.Re|ferences|
|00000140| 3a 20 3c 50 69 6e 65 2e | 53 55 4e 2e 33 2e 39 30 |: <Pine.|SUN.3.90|
|00000150| 2e 39 36 30 34 31 30 32 | 31 34 39 32 35 2e 31 30 |.9604102|14925.10|
|00000160| 32 39 34 42 2d 31 30 30 | 30 30 30 40 72 6f 73 65 |294B-100|000@rose|
|00000170| 2e 63 73 2e 6f 64 75 2e | 65 64 75 3e 0a 4e 4e 54 |.cs.odu.|edu>.NNT|
|00000180| 50 2d 50 6f 73 74 69 6e | 67 2d 48 6f 73 74 3a 20 |P-Postin|g-Host: |
|00000190| 6d 69 74 74 65 6e 73 2e | 73 74 75 2e 72 70 69 2e |mittens.|stu.rpi.|
|000001a0| 65 64 75 0a 4d 69 6d 65 | 2d 56 65 72 73 69 6f 6e |edu.Mime|-Version|
|000001b0| 3a 20 31 2e 30 0a 43 6f | 6e 74 65 6e 74 2d 54 79 |: 1.0.Co|ntent-Ty|
|000001c0| 70 65 3a 20 54 45 58 54 | 2f 50 4c 41 49 4e 3b 20 |pe: TEXT|/PLAIN; |
|000001d0| 63 68 61 72 73 65 74 3d | 55 53 2d 41 53 43 49 49 |charset=|US-ASCII|
|000001e0| 0a 49 6e 2d 52 65 70 6c | 79 2d 54 6f 3a 20 3c 50 |.In-Repl|y-To: <P|
|000001f0| 69 6e 65 2e 53 55 4e 2e | 33 2e 39 30 2e 39 36 30 |ine.SUN.|3.90.960|
|00000200| 34 31 30 32 31 34 39 32 | 35 2e 31 30 32 39 34 42 |41021492|5.10294B|
|00000210| 2d 31 30 30 30 30 30 40 | 72 6f 73 65 2e 63 73 2e |-100000@|rose.cs.|
|00000220| 6f 64 75 2e 65 64 75 3e | 20 0a 0a 4f 6e 20 57 65 |odu.edu>| ..On We|
|00000230| 64 2c 20 31 30 20 41 70 | 72 20 31 39 39 36 2c 20 |d, 10 Ap|r 1996, |
|00000240| 43 4c 45 56 45 4c 41 4e | 44 20 4f 2e 20 42 55 52 |CLEVELAN|D O. BUR|
|00000250| 4e 45 54 54 20 77 72 6f | 74 65 3a 0a 0a 3e 20 49 |NETT wro|te:..> I|
|00000260| 20 68 61 76 65 20 61 20 | 74 65 78 74 66 69 6c 65 | have a |textfile|
|00000270| 20 74 68 61 74 20 49 20 | 61 6d 20 74 72 79 69 6e | that I |am tryin|
|00000280| 67 20 74 6f 20 72 65 61 | 64 20 61 73 20 61 20 43 |g to rea|d as a C|
|00000290| 2b 2b 20 20 73 74 72 75 | 63 74 21 21 21 21 21 0a |++ stru|ct!!!!!.|
|000002a0| 3e 20 0a 3e 20 48 6f 77 | 20 63 61 6e 20 49 20 64 |> .> How| can I d|
|000002b0| 6f 20 74 68 69 73 3f 0a | 0a 3e 20 73 74 72 75 63 |o this?.|.> struc|
|000002c0| 74 20 73 74 75 64 65 6e | 74 73 20 7b 0a 3e 20 63 |t studen|ts {.> c|
|000002d0| 68 61 72 20 66 69 72 73 | 74 6e 61 6d 65 5b 32 30 |har firs|tname[20|
|000002e0| 5d 3b 0a 3e 20 63 68 61 | 72 20 6d 69 64 64 6c 65 |];.> cha|r middle|
|000002f0| 5f 69 6e 69 74 69 61 6c | 3b 0a 3e 20 63 68 61 72 |_initial|;.> char|
|00000300| 20 6c 61 73 74 6e 61 6d | 65 5b 32 30 5d 3b 0a 3e | lastnam|e[20];.>|
|00000310| 20 63 68 61 72 20 61 64 | 64 72 65 73 73 31 5b 34 | char ad|dress1[4|
|00000320| 30 5d 3b 0a 3e 20 63 68 | 61 72 20 61 64 64 72 65 |0];.> ch|ar addre|
|00000330| 73 73 32 5b 33 30 5d 3b | 0a 3e 20 63 68 61 72 20 |ss2[30];|.> char |
|00000340| 70 68 6f 6e 65 5f 6e 75 | 6d 62 65 72 5b 37 5d 3b |phone_nu|mber[7];|
|00000350| 0a 3e 20 63 68 61 72 20 | 65 6d 61 69 6c 5b 35 30 |.> char |email[50|
|00000360| 5d 3b 7d 3b 0a 3e 20 0a | 0a 49 63 6b 2e 2e 20 6f |];};.> .|.Ick.. o|
|00000370| 6b 2c 20 66 69 72 73 74 | 20 6f 66 20 61 6c 6c 2c |k, first| of all,|
|00000380| 20 55 53 45 20 57 48 49 | 54 45 53 50 41 43 45 2e | USE WHI|TESPACE.|
|00000390| 0a 0a 73 74 72 75 63 74 | 20 73 74 75 64 65 6e 74 |..struct| student|
|000003a0| 73 20 7b 0a 20 20 63 68 | 61 72 20 66 69 72 73 74 |s {. ch|ar first|
|000003b0| 6e 61 6d 65 5b 32 30 5d | 3b 0a 20 20 63 68 61 72 |name[20]|;. char|
|000003c0| 20 6d 69 64 64 6c 65 5f | 69 6e 69 74 69 61 6c 3b | middle_|initial;|
|000003d0| 0a 20 20 63 68 61 72 20 | 6c 61 73 74 6e 61 6d 65 |. char |lastname|
|000003e0| 5b 32 30 5d 3b 0a 20 20 | 63 68 61 72 20 61 64 64 |[20];. |char add|
|000003f0| 72 65 73 73 31 5b 34 30 | 5d 3b 0a 20 20 63 68 61 |ress1[40|];. cha|
|00000400| 72 20 61 64 64 72 65 73 | 73 32 5b 33 30 5d 3b 0a |r addres|s2[30];.|
|00000410| 20 20 63 68 61 72 20 70 | 68 6f 6e 65 5f 6e 75 6d | char p|hone_num|
|00000420| 62 65 72 5b 37 5d 3b 0a | 20 20 63 68 61 72 20 65 |ber[7];.| char e|
|00000430| 6d 61 69 6c 5b 35 30 5d | 3b 0a 7d 3b 0a 0a 4e 6f |mail[50]|;.};..No|
|00000440| 77 20 74 68 61 74 20 79 | 6f 75 20 68 61 76 65 20 |w that y|ou have |
|00000450| 74 68 61 74 20 64 6f 6e | 65 2c 20 69 74 20 77 6f |that don|e, it wo|
|00000460| 75 6c 64 20 62 65 20 61 | 20 73 69 6d 70 6c 65 20 |uld be a| simple |
|00000470| 6d 61 74 74 65 72 20 74 | 6f 20 72 65 61 64 20 69 |matter t|o read i|
|00000480| 6e 20 74 68 65 20 0a 64 | 61 74 61 2c 20 62 75 74 |n the .d|ata, but|
|00000490| 20 79 6f 75 27 6c 6c 20 | 68 61 76 65 20 74 6f 20 | you'll |have to |
|000004a0| 72 65 61 64 20 74 68 65 | 20 64 61 74 61 20 69 6e |read the| data in|
|000004b0| 74 6f 20 65 61 63 68 20 | 6d 65 6d 62 65 72 20 61 |to each |member a|
|000004c0| 74 20 61 20 74 69 6d 65 | 2c 20 6c 69 6b 65 20 74 |t a time|, like t|
|000004d0| 68 69 73 3a 0a 0a 73 74 | 75 64 65 6e 74 73 20 66 |his:..st|udents f|
|000004e0| 6f 6f 3b 0a 66 73 74 72 | 65 61 6d 20 73 6f 6d 65 |oo;.fstr|eam some|
|000004f0| 73 74 72 65 61 6d 3b 0a | 0a 5b 2e 2e 5d 20 09 09 |stream;.|.[..] ..|
|00000500| 09 09 20 2f 2f 20 69 6e | 69 74 20 73 6f 6d 65 73 |.. // in|it somes|
|00000510| 74 72 65 61 6d 20 68 65 | 72 65 0a 0a 73 6f 6d 65 |tream he|re..some|
|00000520| 73 74 72 65 61 6d 20 3e | 3e 20 66 6f 6f 2e 66 69 |stream >|> foo.fi|
|00000530| 72 73 74 6e 61 6d 65 20 | 3e 3e 20 66 6f 6f 2e 69 |rstname |>> foo.i|
|00000540| 6e 69 74 69 61 6c 20 3e | 3e 20 2e 2e 20 3e 3e 20 |nitial >|> .. >> |
|00000550| 66 6f 6f 2e 70 68 6f 6e | 65 5f 6e 75 6d 62 65 72 |foo.phon|e_number|
|00000560| 0a 20 20 20 20 20 20 20 | 20 20 20 20 3e 3e 20 66 |. | >> f|
|00000570| 6f 6f 2e 65 6d 61 69 6c | 3b 0a 5b 2e 2e 5d 0a 0a |oo.email|;.[..]..|
|00000580| 6f 72 2c 20 79 6f 75 20 | 63 61 6e 20 77 72 69 74 |or, you |can writ|
|00000590| 65 20 61 20 63 6c 61 73 | 73 2c 20 6f 76 65 72 6c |e a clas|s, overl|
|000005a0| 6f 61 64 20 74 68 65 20 | 3e 3e 20 6f 70 65 72 61 |oad the |>> opera|
|000005b0| 74 6f 72 2c 20 61 6e 64 | 20 64 6f 20 69 74 20 74 |tor, and| do it t|
|000005c0| 68 69 73 20 77 61 79 3a | 0a 0a 73 74 75 64 65 6e |his way:|..studen|
|000005d0| 74 73 20 62 61 72 3b 0a | 66 73 74 72 65 61 6d 20 |ts bar;.|fstream |
|000005e0| 73 6f 6d 65 73 74 72 65 | 61 6d 3b 0a 0a 5b 2e 2e |somestre|am;..[..|
|000005f0| 5d 09 09 09 09 2f 2f 20 | 69 6e 69 74 20 73 6f 6d |]....// |init som|
|00000600| 65 73 74 72 65 61 6d 20 | 68 65 72 65 0a 0a 73 6f |estream |here..so|
|00000610| 6d 65 73 74 72 65 61 6d | 20 3e 3e 20 62 61 72 3b |mestream| >> bar;|
|00000620| 0a 0a 5b 2e 2e 5d 0a 0a | 77 68 69 63 68 20 72 65 |..[..]..|which re|
|00000630| 73 75 6c 74 73 20 69 6e | 20 61 20 6d 75 63 68 20 |sults in| a much |
|00000640| 63 6c 65 61 6e 65 72 20 | 63 6f 64 65 2e 20 48 6f |cleaner |code. Ho|
|00000650| 77 65 76 65 72 2c 20 69 | 66 20 79 6f 75 20 64 6f |wever, i|f you do|
|00000660| 20 6e 6f 74 20 6b 6e 6f | 77 20 68 6f 77 20 74 6f | not kno|w how to|
|00000670| 20 0a 6f 76 65 72 6c 6f | 61 64 20 6f 70 65 72 61 | .overlo|ad opera|
|00000680| 74 6f 72 73 2c 20 74 68 | 65 20 66 69 72 73 74 20 |tors, th|e first |
|00000690| 61 70 70 72 6f 61 63 68 | 20 69 73 20 6a 75 73 74 |approach| is just|
|000006a0| 20 61 73 20 76 61 6c 69 | 64 20 28 74 68 6f 75 67 | as vali|d (thoug|
|000006b0| 68 20 73 6f 6d 65 74 69 | 6d 65 73 20 0a 66 72 6f |h someti|mes .fro|
|000006c0| 77 6e 65 64 20 75 70 6f | 6e 29 2e 0a 0a 4e 65 78 |wned upo|n)...Nex|
|000006d0| 78 0a 0a 45 61 63 68 20 | 64 61 79 20 6f 66 20 61 |x..Each |day of a|
|000006e0| 20 70 65 72 73 6f 6e 27 | 73 20 6c 69 66 65 20 69 | person'|s life i|
|000006f0| 73 20 61 20 62 61 74 74 | 6c 65 3b 0a 54 68 65 20 |s a batt|le;.The |
|00000700| 65 6e 74 69 72 65 20 6c | 69 66 65 20 62 65 69 6e |entire l|ife bein|
|00000710| 67 20 74 68 65 20 77 61 | 72 2e 0a 41 20 77 61 72 |g the wa|r..A war|
|00000720| 2c 20 6e 6f 74 20 61 67 | 61 69 6e 73 74 20 61 6e |, not ag|ainst an|
|00000730| 79 62 6f 64 79 20 65 6c | 73 65 3b 0a 42 75 74 20 |ybody el|se;.But |
|00000740| 6f 6e 65 20 66 6f 75 67 | 68 74 20 61 67 61 69 6e |one foug|ht again|
|00000750| 73 74 20 6f 6e 65 73 65 | 6c 66 2e 0a 4f 6e 65 20 |st onese|lf..One |
|00000760| 6e 65 65 64 20 6e 65 76 | 65 72 20 74 6f 20 66 69 |need nev|er to fi|
|00000770| 67 68 74 20 61 6c 6f 6e | 65 3b 0a 4f 6e 65 20 73 |ght alon|e;.One s|
|00000780| 68 61 6c 74 20 61 6c 77 | 61 79 73 20 68 61 76 65 |halt alw|ays have|
|00000790| 20 63 6f 6d 70 61 6e 69 | 6f 6e 73 20 6f 66 20 74 | compani|ons of t|
|000007a0| 68 65 20 68 65 61 72 74 | 2e 0a 0a 0a |he heart|.... |
+--------+-------------------------+-------------------------+--------+--------+